package util;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;

import javax.servlet.http.HttpServletResponse;

public abstract class Util {

  public static String[] toArray(ArrayList<String> arg) {
    String[] ret = new String[arg.size()];
    arg.toArray(ret);
    return ret;
  }
  
  public static int[] toArrayInt(String[] obj) {
    int[] ret = new int[obj.length];
    for (int i = 0; i < ret.length; ++i) {
      ret[i] = Integer.valueOf(obj[i]);
    }
    return ret;
  }
  
  public static void PrintAndClose(HttpServletResponse response,
                                   String message) throws IOException {
    PrintWriter writer = response.getWriter();
    writer.print(message);
    writer.close();
  }
  
}
